package com.sf.algo.solve.solver;

import com.sf.algo.solve.domain.Location;

public class DirectionUtils {
	
	public static String calcDirection(Location from, Location to) {
		if (from.getX() == to.getX() && from.getY() > to.getY()) {
			return "L";
		} else if (from.getX() == to.getX() && from.getY() < to.getY()) {
			return "R";
		} 
		if (from.getY() == to.getY() && from.getX() > to.getX()) {
			return "U";
		}
		return "D";
	}
	
	public static void main(String[] args) {
		System.out.println(DirectionUtils.calcDirection(new Location(1,0), new Location(2,0)));
		System.out.println(DirectionUtils.calcDirection(new Location(2,0), new Location(1,0)));
		System.out.println(DirectionUtils.calcDirection(new Location(1,0), new Location(1,1)));
		System.out.println(DirectionUtils.calcDirection(new Location(1,1), new Location(1,0)));
	}
	
}
